#include <unistd.h>
#include <mpi.h>
#include <iostream>
using namespace std;


int 
main(int argc, char * argv[])
{
  int rank;
  MPI_Status status;
  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  double a[1];
  a[0] = 0.0;
  double local_a[1] ; 
  local_a[0] = (double)(rank + 5);
  MPI_Allreduce(local_a,a, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
  cout << a[0] << endl;
  MPI_Finalize();
  return 0;
}

